﻿<%@ Page Language="C#" AutoEventWireup="true" EnableSessionState="True" %>

<%@ Register TagPrefix="wnxd" Assembly="wnxd.Web" Namespace="wnxd.Web" %>
<%@ Import Namespace="wnxd.javascript" %>
<%@ Import Namespace="wnxd.Web" %>
<%@ Import Namespace="System.IO" %>
<script runat="server">
    bool Add()
    {
        string path = this.MapPath("~/config/ipconfig.json");
        json json;
        if (File.Exists(path)) json = new json(File.ReadAllText(path));
        else json = new json();
        string JumpUrl = this.Request.Form["JumpUrl"];
        web web = web.FindFirst();
        if (string.IsNullOrEmpty(JumpUrl))
        {
            web.AddScript("alert('请输入待跳转的url');");
        }
        else
        {
            File.WriteAllText(path, JumpUrl);
            web.AddScript("alert('添加成功');");
        }
        return true;
    }
</script>
<wnxd:Web runat="server" />
<html>
<head>
    <title>配置跳转</title>
</head>
<body>
    <div id="form">
        <div>
            跳转url:
        <input type="text" name="JumpUrl" />
        </div>
        <input type="button" prefix="wnxd_Ajax" inc="form" act="form" onclick="Add" value="添加" />
    </div>
</body>
</html>
